<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="vue.js"></script>
</head>
<body>
    <div id="id1">
        <p v-if="flag">用 v-if控制</p>
        <!-- if 会删除标贴 -->

        
        <p v-show="flag">用 v-show控制</p>
        <input type="button" value="按钮" @click ="ann1">
    </div>

    <script>
    var vm = new Vue({
        el : '#id1',
        data : {
            flag : false,
        },
        methods: {
            ann1(){
                this.flag = !this.flag
            }
            
        },
    })
    </script>
</body>
</html>